home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 API Bible / Windows 95 API Bible 3 Disc Set.iso / Win32 API Bible Book 1 of 3.iso / chapte21 / ex3.c < prev    next >
C/C++ Source or Header  |  1995-05-29  |  1KB  |  38 lines

  1. #include <genstub.c>
  2.  
  3. LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  4. {
  5.    switch (uMsg)
  6.    {
  7.          case WM_COMMAND:
  8.                switch ( LOWORD( wParam ) )
  9.                {
  10.                      case IDM_TEST:
  11.                      {
  12.                            char szBuffer[MAX_PATH + 21];
  13.                            DWORD dwcNameSize = MAX_PATH + 1;
  14.                            HDC hDC = GetDC( hWnd );
  15.  
  16.                            lstrcpy( szBuffer, "Windows Directory: " );
  17.                            GetWindowsDirectory( &szBuffer[19], (UINT) dwcNameSize );
  18.                            TextOut( hDC, 0, 20, szBuffer, strlen( szBuffer ) );
  19.                            lstrcpy( szBuffer, "System Directory: " );
  20.                            GetSystemDirectory( &szBuffer[18], (UINT) dwcNameSize );
  21.                            TextOut( hDC, 0, 40, szBuffer, strlen( szBuffer ) );
  22.  
  23.                            ReleaseDC( hWnd, hDC );
  24.                      }
  25.                      break;
  26.                      case IDM_EXIT:
  27.                            DestroyWindow( hWnd );
  28.                            break;
  29.                }
  30.                break;
  31.          case WM_DESTROY:
  32.                PostQuitMessage( 0 );
  33.                break;
  34.          default:
  35.                return (DefWindowProc(hWnd, uMsg, wParam, lParam));
  36.    }
  37.    return (NULL);
  38. }